/*
-----------------------------------------------------------------------------
This source file is part of SapphireEngine

SapphireEngine is a Framework for Turn Based Strategy games.
For more information see http://code.google.com/p/sapphire-engine/

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/copyleft/lesser.txt.

-----------------------------------------------------------------------------
*/
#ifndef _PART_NODE_H
#define _PART_NODE_H

#include <Ogre.h>
#include "SapphirePrerequisites.h"
//#include "Core/Part.h"

using namespace Ogre;

namespace SapphireEngine
{
	namespace Core
	{
		/** Defines a connection anchor on a Part.
		@remarks
			Every Part in SapphireEngine can have anchors with which child Parts 
			could be connected to create hierarchies for Units.
			PartNode defines the information that should be saved for each anchor point.
		@par
			The Blueprint Part should be defined without a pointer to a child Part,
			as it is a concept for a Part and not an actual instance in a Unit.
		*/
		class PartNode 
		{
		public:
			/** Constructor for PartNode Class.
			@remarks
				Set the PartNode default data.
			@param
				Type, defines the general type of the part i.e "Body","Movement","Weapon".
					These types are Hard-Coded in the system and other types should not be assigned.
			@param
				SubType, defines the game specific subtypes that classify the Part i.e "HeavyVehicle",
					"LightCuiser","EpicCannon" etc.
			@param
				Position, defines the position of the Part in its parent's Co-ordinate space.
			@param
				Orientation, defines how the Part it oriented relative to its parent using a Ogre::Quaternion.
			@param
				Scale, defines the size of the Part, values above 1 increase size, below 1 decrease size.
					Negative values flip the Part.
			@param
				Part, points to the actual Part that is connected to the anchor node.
					Should be a Null pointer when defining a Part Blueprint.
			*/
			PartNode(Ogre::String type, Ogre::String subType, Ogre::Vector3 position=Ogre::Vector3(0,0,0),
				Ogre::Quaternion orientation=Ogre::Quaternion(1,0,0,0), Ogre::Vector3 scale=Ogre::Vector3(1,1,1), Part* part=0);
			/// Set the pointer to an instance of a Part, i.e in a Unit or a Formation.
			void setPart(Part* part);
			/// Retrieves the instanced Part connected to the anchor node.
			Part* getPart();
			
			/// Sets the Part type that would be connected to the anchor node.
			void setType(Ogre::String type);
			/// Retrieves the Part type that would be connected to the anchor node. 
			Ogre::String getType();

			/// Sets the Part subtype that would be connected to the anchor node.
			void setSubType(Ogre::String subType);
			/// Retrieves the Part subtype that would be connected to the anchor node.
			Ogre::String getSubType();

			/// Sets the position for the connected Part.
			void setPosition(Ogre::Vector3 position);
			/// Retrieves the position for the connected Part.
			Ogre::Vector3 getPosition();

			/// Sets the orientation for the connected Part.
			void setOrientation(Ogre::Quaternion orientation);
			/// Retrieves the orientation for the connected Part.
			Ogre::Quaternion getOrientation();

			/// Sets the scale for the connected Part.
			void setScale(Ogre::Vector3 scale);
			/// Retrieves the scale for the connected Part.
			Ogre::Vector3 getScale();

		protected:
			Part* mPart;
			Ogre::String mType;			
			Ogre::String mSubType;
			Ogre::Vector3 mPosition;
			Ogre::Quaternion mOrientation;
			Ogre::Vector3 mScale;

		}; //class PartNode
	} //namespace Core
} //namespace SapphireEngine


#endif